﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter04
{
    public class MainWindowViewModel
    {
        private List<Unit> catalogues;

        public MainWindowViewModel()
        {
            catalogues = new List<Unit>();
            catalogues.Add(new Unit { Num = 1, Title = "继承" });
            catalogues.Add(new Unit
            {
                Num = 2,
                Title = "继承的类型",
                ChildCatalogues = new List<Unit>
                {
                    new Unit { Num = 2.1, Title = "实现继承和接口继承" }, 
                    new Unit { Num = 2.2, Title = "多重继承" },
                    new Unit { Num = 2.3, Title = "结构和类" },
                }
            });
            catalogues.Add(new Unit
            {
                Num = 3,
                Title = "实现继承",
                ChildCatalogues = new List<Unit> 
                { 
                    new Unit { Num = 3.1, Title = "虚方法" }, 
                    new Unit { Num = 3.2, Title = "隐藏方法" },
                    new Unit { Num = 3.3, Title = "调用函数的基类版本" }, 
                    new Unit { Num = 3.4, Title = "抽象类和抽象函数" }, 
                    new Unit { Num = 3.5, Title = "密封类和密封方法" }, 
                    new Unit { Num = 3.6, Title = "派生类的构造函数" }, 
                }
            });
            catalogues.Add(new Unit
            {
                Num = 4,
                Title = "修饰符",
                ChildCatalogues = new List<Unit> 
                { 
                    new Unit { Num = 4.1, Title = "可见性修饰符" }, 
                    new Unit { Num = 4.2, Title = "其他修饰符" },
                }
            });
            catalogues.Add(new Unit
            {
                Num = 5,
                Title = "接口",
                ChildCatalogues = new List<Unit> 
                { 
                    new Unit { Num = 5.1, Title = "定义和实现接口" }, 
                    new Unit { Num = 5.2, Title = "派生的接口" },
                }
            });
            catalogues.Add(new Unit { Num = 6, Title = "小结" });
        }

        public List<Unit> Catalogues
        {
            get { return catalogues; }
        }

        public class Unit
        {
            public double Num { get; set; }
            public string Title { get; set; }
            public string Sample { get; set; }
            public List<Unit> ChildCatalogues { get; set; }
        }

        public override string ToString()
        {
            return "第04章 继承";
        }
    }
}
